<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
  	<meta charset="utf-8">
	<meta name="renderer" content="webkit">
 	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
 	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  	<title>${SYSTEM_NAME}</title>
	<link rel="stylesheet" href="${pageContext.request.contextPath}/static/layuiadmin/layui/css/layui.css" media="all">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/static/layuiadmin/style/admin.css" media="all">
  	<link rel="stylesheet" href="${pageContext.request.contextPath}/static/js/zTree_v3/css/metroStyle/metroStyle.css?v=${FILE_VERSION}" type="text/css">
</head>
<body>
<div class="layui-fluid" style="background-color: #fff;">
	<input id="queryTop" value="${queryTop }" type="hidden">
 	<ul id="treeRegion" class="ztree"></ul>
 </div>

<script src="${pageContext.request.contextPath}/static/js/common-2.0.0.js?v=${FILE_VERSION}"></script>
<script src="${pageContext.request.contextPath}/static/layuiadmin/layui/layui.js?v=${FILE_VERSION}"></script>
<script src="${pageContext.request.contextPath}/static/js/jquery-3.3.1.min.js?v=${FILE_VERSION}"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/zTree_v3/js/jquery.ztree.core.js?v=${FILE_VERSION}"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/zTree_v3/js/jquery.ztree.excheck.js?v=${FILE_VERSION}"></script>
<script>
	var layer;
	layui.use(['layer'], function() {
		layer = layui.layer;
	});

var ZtreeObj;

var setting = {
	data: {
		simpleData: {
			enable: true
		}
	},
	edit: {
		enable: false
	},
	callback : {
		onClick: treeOnClick 
	}
};


function treeOnClick(event, treeId, treeNode) {
	parentName = treeNode.name;
	parent.setMenuValue(treeNode.id,treeNode.name);
}

$(document).ready(function(){
	var queryTop = $("#queryTop").val();
	$.ajax({
	    url : getContextPath() + '/sys/menu/list/listAllTree?queryTop=' + queryTop,
	    type : "post",
	    dataType : "text",
	    success : function(data) {
	    	var zNodes = eval("(" + data + ")");
	    	ZtreeObj = $.fn.zTree.init($("#treeRegion"), setting, zNodes);
	    },
	    error : function(XMLHttpRequest, textStatus) {
	    	layer.msg(textStatus);
	    }
	});
});


function closed(){
	var index = parent.layer.getFrameIndex(window.name); //获取窗口索引  
	parent.layer.close(index);//关闭弹出的子页面窗口
}


</script>
</body>
</html>